import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import HomeIndex from "../views/home/HomeIndex.vue";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/home",
    name: "home",
    component: HomeIndex,
    children: [
      {
        path: "zongjuLianlu",
        component: () => import("../views/lianluInfo/ZongjuLianlu.vue"),
      },
      {
        path: "neimengLianlu",
        component: () => import("../views/lianluInfo/NeimengLianlu.vue"),
      },
      {
        path: "guangdongLianlu",
        component: () => import("../views/lianluInfo/GuangdongLianlu.vue"),
      },
      {
        path: "shanghaiLianlu",
        component: () => import("../views/lianluInfo/ShanghaiLianlu.vue"),
      },
      {
        path: "nodeInfo",
        component: () => import("../views/nodesInfo/NodesInfo.vue"),
      },
    ],
    redirect: "/home/zongjuLianlu",
  },
  {
    path: "/message",
    name: "message",
    component: () => import("../views/message/MessageIndex.vue"),
  },
  {
    path: "/errorLianlu",
    name: "errorLianlu",
    component: () => import("../views/errorLianlu/ErrorLianlu.vue"),
  },
  {
    path: "/canErrorLianlu",
    name: "canErrorLianlu",
    component: () => import("../views/errorLianlu/CanErrorLianlu.vue"),
  },
  {
    path: "/about",
    name: "about",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
  },
  {
    path: "/",
    redirect: "/home",
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
